#ifndef COMBOBOXEX_H
#define COMBOBOXEX_H

#include <QComboBox>

class ComboBoxEx : public QComboBox
{
    Q_OBJECT
public:
    explicit ComboBoxEx(QWidget *parent = nullptr);

protected:
    bool eventFilter(QObject *target, QEvent *event);
    void viewOnMouseMove(QMouseEvent *e);
    void viewOnMousePress(QMouseEvent *e);
    void viewOnMouseRelease(QMouseEvent *e);

private:
    // 鼠标是否按下
    bool m_MousePressed;
    // 鼠标移动过的距离之和
    int m_TotalMove;
    // 鼠标按下时，滚动条的位置
    int m_ScrollPosOnPress;
    // 鼠标按下的坐标位置
    QPoint m_PressPosition;
};

#endif // COMBOBOXEX_H
